package cn.wuxing.mediation.system.service.impl;

import java.util.List;
import cn.wuxing.mediation.common.utils.DateUtils;
import cn.wuxing.mediation.system.domain.UserTownshipCenter;
import cn.wuxing.mediation.system.mapper.UserTownshipCenterMapper;
import cn.wuxing.mediation.system.service.ISUserTownshipCenterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 用户和乡镇治理中心关联Service业务层处理
 *
 * @author mediation
 * @date 2024-10-10
 */
@Service
public class ISUserTownshipCenterServiceImpl implements ISUserTownshipCenterService
{
    @Resource
    private UserTownshipCenterMapper userTownshipCenterMapper;

    /**
     * 查询用户和乡镇治理中心关联
     *
     * @param id 用户和乡镇治理中心关联主键
     * @return 用户和乡镇治理中心关联
     */
    @Override
    public UserTownshipCenter selectUserTownshipCenterById(Long id)
    {
        return userTownshipCenterMapper.selectUserTownshipCenterById(id);
    }

    /**
     * 查询用户和乡镇治理中心关联列表
     *
     * @param userTownshipCenter 用户和乡镇治理中心关联
     * @return 用户和乡镇治理中心关联
     */
    @Override
    public List<UserTownshipCenter> selectUserTownshipCenterList(UserTownshipCenter userTownshipCenter)
    {
        return userTownshipCenterMapper.selectUserTownshipCenterList(userTownshipCenter);
    }

    /**
     * 新增用户和乡镇治理中心关联
     *
     * @param userTownshipCenter 用户和乡镇治理中心关联
     * @return 结果
     */
    @Override
    public int insertUserTownshipCenter(UserTownshipCenter userTownshipCenter)
    {
        userTownshipCenter.setCreateTime(DateUtils.getNowDate());
        return userTownshipCenterMapper.insertUserTownshipCenter(userTownshipCenter);
    }

    /**
     * 修改用户和乡镇治理中心关联
     *
     * @param userTownshipCenter 用户和乡镇治理中心关联
     * @return 结果
     */
    @Override
    public int updateUserTownshipCenter(UserTownshipCenter userTownshipCenter)
    {
        userTownshipCenter.setUpdateTime(DateUtils.getNowDate());
        return userTownshipCenterMapper.updateUserTownshipCenter(userTownshipCenter);
    }

    /**
     * 批量删除用户和乡镇治理中心关联
     *
     * @param ids 需要删除的用户和乡镇治理中心关联主键
     * @return 结果
     */
    @Override
    public int deleteUserTownshipCenterByIds(Long[] ids)
    {
        return userTownshipCenterMapper.deleteUserTownshipCenterByIds(ids);
    }

    /**
     * 删除用户和乡镇治理中心关联信息
     *
     * @param id 用户和乡镇治理中心关联主键
     * @return 结果
     */
    @Override
    public int deleteUserTownshipCenterById(Long id)
    {
        return userTownshipCenterMapper.deleteUserTownshipCenterById(id);
    }
}
